from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop005_1订单管理查询正常订单"

rootPath = get_pro_rootpath()     #获取项目绝对路径

filePath = rootPath+r'\public\order1.txt'      #拼接文件按路径

orderID = readFile(filePath)
print(orderID)

firefox = openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
# 1.点击销售管理订单管理界面。
DBshopEnterMenu2(firefox,'销售管理','订单管理')
# 2.在订单号查询框输入“1594531607860011”，点击“搜索”按钮。
DBshopSearchOrderID(firefox,orderID)
#订单数是1为预期值
#获取当前订单数
s=firefox.find_element_by_xpath('//body').text
# print(s)
l='订单数：'
r='\)'
num=reGetString(s,l,r)
print(num)

try:
    num = reGetString(s,l,r)
    if num == '1':
        writeLog('% 测试成功'%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()